<template>
  <div id="bjt" >
    <div id="win" style="border: 1px solid burlywood;" >
      <h1 style="text-align: center;">站点登录</h1>
      <div class="text">
        <el-input placeholder="请输入账号"  v-model="siteAccount">
          <template slot="prepend">账号:</template>
        </el-input>
      </div>
      <div class="text">
        <el-input  placeholder="请输入密码" v-model="sitePass" show-password>
          <template slot="prepend">密 码:</template>
        </el-input>
      </div>

      <el-row id="anniu">
        <el-button type="primary" style="width: 180px;" @click="cacelLogin">登录首页</el-button>
        <el-button id="okToLogin" type="primary" style="width: 180px;margin-left: 40px;" @click="siteLogin">登录</el-button>
      </el-row>
    </div>
  </div>
</template>

<script>
  export default {
    name: "SiteLogin",
    data() {
      return {
        sitePass:"",
        siteAccount:"",
      }
    },
    methods: {
      //登录
      siteLogin(){
        this.$http.post("/site/siteAccount/login.site",{
          sitePwd:this.sitePass,
          siteAccount:this.siteAccount,
        }).then(resp=>{          
          if(resp.data.code==200){
            alert(resp.data.message)
            localStorage.setItem("siteAccountMessage",JSON.stringify(resp.data.data))
            this.$router.push("/siteOrderTaking")
          }else{
            alert(resp.data.message)
          }
        })
      },
      //取消登录
      cacelLogin(){
        this.$router.push("/index")
      },

    },
    created() {

    }

  }
</script>

<style>
  .loginMethod{
    font-size: 15px;
    margin-left: 50px;
    font-weight: 100;
  }
  #bjt {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-repeat: no-repeat;
    background-size: 1600px auto;
  }
  #win {
    border-radius: 50px;
    padding: 20px;
    margin-top: 200px;
    margin-left: 200px;
    width: 500px;
    background-color: rgba(255,255,255,0.80);
  }

  #anniu {
    margin-left: 50px;
    margin-top: 30px;
  }

  .text {
    margin-left: 50px;
    margin-top: 30px;
    width: 400px;
  }
</style>
